# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[MenuEventHandler.__init__(self, player)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7757dec>}
nname: 0
n 0(None)[self.player.browse_selected()
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7757fac>}
nname: 0
n 0(None)[self.player.execute_selected()
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7757f2c>}
nname: 0
n 0(None)[self.player.browse_previous()
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7757e2c>}
nname: 0
n 0(None)[self.player.action_info()
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7757f4c>}
nname: 34
n 34(None)[return True
]:
	i: 16(), 33()
	o: 

nname: 33
n 33(None)[]:
	i: 0(f)
	o: 34()

nname: 16
n 16(None)[self.player._error_spawner()
]:
	i: 0(t)
	o: 34()

nname: 0
n 0(pygui_globs['menustack'].get_player())[]:
	i: 
	o: 16(t), 33(f)

nname: 0
n 0(None)[if pygui_globs['menustack'].get_player():
	self.player._error_spawner()
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7757dac>}
nname: 34
n 34(None)[return True
]:
	i: 16(), 33()
	o: 

nname: 33
n 33(None)[]:
	i: 0(t)
	o: 34()

nname: 16
n 16(None)[self.player._error_spawner()
]:
	i: 0(f)
	o: 34()

nname: 0
n 0(pygui_globs['menustack'].toggle())[]:
	i: 
	o: 16(f), 33(t)

nname: 0
n 0(None)[if not pygui_globs['menustack'].toggle():
	self.player._error_spawner()
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7757fcc>}
nname: 200
n 200(None)[return True
]:
	i: 169(), 199()
	o: 

nname: 199
n 199(None)[]:
	i: 93(f)
	o: 200()

nname: 169
n 169(None)[s.select(-1)
s.select(1)
]:
	i: 93(t)
	o: 200()

nname: 93
n 93(sel == None)[context = dict(menu=self.player, selected=sel, parent=parent)
s = ActionMenu(context, universe=self.player.universe)
s.show()
]:
	i: 59(), 83()
	o: 169(t), 199(f)

nname: 83
n 83(None)[parent = sel.parent
]:
	i: 0&46(f)
	o: 93()

nname: 59
n 59(None)[parent = self.player._history[-1]['selected']
]:
	i: 0&46(t)
	o: 93()

nname: 0&46
n 0&46(sel is None and self.player._history)[sel = self.player.selected
from pygui.menu.menu import ActionMenu
parent = None
]:
	i: 
	o: 59(t), 83(f)

nname: 0&46
n 0&46(None)[sel = self.player.selected
from pygui.menu.menu import ActionMenu
parent = None
if sel is None and self.player._history:
	parent = self.player._history[-1]['selected']
else:
	parent = sel.parent
context = dict(menu=self.player, selected=sel, parent=parent)
s = ActionMenu(context, universe=self.player.universe)
s.show()
if sel == None:
	s.select(-1)
	s.select(1)
return True
]:
	i: 
	o: 

self.nodes: {'0&46': <unpyclib.structure.node instance at 0xb775ccec>}
nname: 239
n 239(None)[return True
]:
	i: 83(), 229()
	o: 

nname: 229
n 229(None)[play._update_marker()
]:
	i: 129(), 214(), 228()
	o: 239()

nname: 228
n 228(None)[]:
	i: 195(f)
	o: 229()

nname: 214
n 214(None)[w.hide()
]:
	i: 195(t)
	o: 229()

nname: 195
n 195(w)[marker.add_item(sel)
]:
	i: 168(), 194()
	o: 214(t), 228(f)

nname: 194
n 194(None)[]:
	i: 146(f)
	o: 195()

nname: 168
n 168(None)[w = LoadingWindow('')
w.show()
]:
	i: 146(t)
	o: 195()

nname: 146
n 146(isinstance(sel, DirItem))[w = None
]:
	i: 97(f)
	o: 168(t), 194(f)

nname: 129
n 129(None)[marker.del_item(sel)
]:
	i: 97(t)
	o: 229()

nname: 97
n 97(sel.is_marked())[marker = markerlists()[self.player.universe]
]:
	i: 52&67(f)
	o: 129(t), 146(f)

nname: 83
n 83(None)[play._error_spawner()
]:
	i: 52&67(t)
	o: 239()

nname: 52&67
n 52&67(isinstance(sel, Markerlist) or sel.universe == 'net_services')[]:
	i: 30(), 51()
	o: 83(t), 97(f)

nname: 51
n 51(None)[]:
	i: 0(f)
	o: 52&67()

nname: 30
n 30(None)[log.warning('Nothing to put in markerlist')
return True
]:
	i: 0(t)
	o: 52&67()

nname: 0
n 0(sel is None)[play = self.player
sel = play.selected
]:
	i: 
	o: 30(t), 51(f)

nname: 239
n 239(None)[return True
]:
	i: 83(), 229()
	o: 

nname: 229
n 229(None)[play._update_marker()
]:
	i: 129(), 146()
	o: 239()

nname: 146
n 146(None)[w = None
if isinstance(sel, DirItem):
	w = LoadingWindow('')
	w.show()
marker.add_item(sel)
if w:
	w.hide()
]:
	i: 97(f)
	o: 229()

nname: 129
n 129(None)[marker.del_item(sel)
]:
	i: 97(t)
	o: 229()

nname: 97
n 97(sel.is_marked())[marker = markerlists()[self.player.universe]
]:
	i: 0(f)
	o: 129(t), 146(f)

nname: 83
n 83(None)[play._error_spawner()
]:
	i: 0(t)
	o: 239()

nname: 0
n 0(isinstance(sel, Markerlist) or sel.universe == 'net_services')[play = self.player
sel = play.selected
if sel is None:
	log.warning('Nothing to put in markerlist')
	return True
]:
	i: 
	o: 83(t), 97(f)

nname: 239
n 239(None)[return True
]:
	i: 83(), 97()
	o: 

nname: 97
n 97(None)[marker = markerlists()[self.player.universe]
if sel.is_marked():
	marker.del_item(sel)
else:
	w = None
	if isinstance(sel, DirItem):
		w = LoadingWindow('')
		w.show()
	marker.add_item(sel)
	if w:
		w.hide()
play._update_marker()
]:
	i: 0(f)
	o: 239()

nname: 83
n 83(None)[play._error_spawner()
]:
	i: 0(t)
	o: 239()

nname: 0
n 0(isinstance(sel, Markerlist) or sel.universe == 'net_services')[play = self.player
sel = play.selected
if sel is None:
	log.warning('Nothing to put in markerlist')
	return True
]:
	i: 
	o: 83(t), 97(f)

nname: 0
n 0(None)[play = self.player
sel = play.selected
if sel is None:
	log.warning('Nothing to put in markerlist')
	return True
if isinstance(sel, Markerlist) or sel.universe == 'net_services':
	play._error_spawner()
else:
	marker = markerlists()[self.player.universe]
	if sel.is_marked():
		marker.del_item(sel)
	else:
		w = None
		if isinstance(sel, DirItem):
			w = LoadingWindow('')
			w.show()
		marker.add_item(sel)
		if w:
			w.hide()
	play._update_marker()
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb775ca6c>}
nname: 6
n 6(None)[__doc__ = '\n    Event manager for Navigator (file browser)\n    '
def __init__(self, player):
	MenuEventHandler.__init__(self, player)

def event_right(self, event):
	self.player.browse_selected()
	return True

def event_select(self, event):
	self.player.execute_selected()
	return True

def event_left(self, event):
	self.player.browse_previous()
	return True

def event_info(self, event):
	self.player.action_info()
	return True

def event_stop(self, event):
	if pygui_globs['menustack'].get_player():
		self.player._error_spawner()
	return True

def event_toggle_menu(self, event):
	if not pygui_globs['menustack'].toggle():
		self.player._error_spawner()
	return True

def event_action_menu(self, event):
	sel = self.player.selected
	from pygui.menu.menu import ActionMenu
	parent = None
	if sel is None and self.player._history:
		parent = self.player._history[-1]['selected']
	else:
		parent = sel.parent
	context = dict(menu=self.player, selected=sel, parent=parent)
	s = ActionMenu(context, universe=self.player.universe)
	s.show()
	if sel == None:
		s.select(-1)
		s.select(1)
	return True

def event_marker(self, event):
	play = self.player
	sel = play.selected
	if sel is None:
		log.warning('Nothing to put in markerlist')
		return True
	if isinstance(sel, Markerlist) or sel.universe == 'net_services':
		play._error_spawner()
	else:
		marker = markerlists()[self.player.universe]
		if sel.is_marked():
			marker.del_item(sel)
		else:
			w = None
			if isinstance(sel, DirItem):
				w = LoadingWindow('')
				w.show()
			marker.add_item(sel)
			if w:
				w.hide()
		play._update_marker()
	return True

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb775796c>}
nname: 0
n 0(None)[self.player.select_vertical(-event.arg['count'])
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb775788c>}
nname: 0
n 0(None)[self.player.select_vertical(event.arg['count'])
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb77576ec>}
nname: 0
n 0(None)[self.player.select_horizontal(-event.arg['count'])
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb77579ac>}
nname: 0
n 0(None)[self.player.select_horizontal(event.arg['count'])
return True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb77576ac>}
nname: 6
n 6(None)[__doc__ = 'Event handler for grid navigators.'
def event_up(self, event):
	self.player.select_vertical(-event.arg['count'])
	return True

def event_down(self, event):
	self.player.select_vertical(event.arg['count'])
	return True

def event_left(self, event):
	self.player.select_horizontal(-event.arg['count'])
	return True

def event_right(self, event):
	self.player.select_horizontal(event.arg['count'])
	return True

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb77573ac>}
nname: 0
n 0(None)[from __future__ import absolute_import
from .core import MenuEventHandler
from peewee.debug import GET_LOGGER
from pygui.item.mediaitem.core import DirItem
from pygui.markerlist import markerlists, Markerlist
from pygui.window import LoadingWindow
from pygui.shared import pygui_globs
log = GET_LOGGER(__name__)
class NavigatorEventHandler(MenuEventHandler):
	__doc__ = '\n    Event manager for Navigator (file browser)\n    '
	def __init__(self, player):
		MenuEventHandler.__init__(self, player)

	def event_right(self, event):
		self.player.browse_selected()
		return True

	def event_select(self, event):
		self.player.execute_selected()
		return True

	def event_left(self, event):
		self.player.browse_previous()
		return True

	def event_info(self, event):
		self.player.action_info()
		return True

	def event_stop(self, event):
		if pygui_globs['menustack'].get_player():
			self.player._error_spawner()
		return True

	def event_toggle_menu(self, event):
		if not pygui_globs['menustack'].toggle():
			self.player._error_spawner()
		return True

	def event_action_menu(self, event):
		sel = self.player.selected
		from pygui.menu.menu import ActionMenu
		parent = None
		if sel is None and self.player._history:
			parent = self.player._history[-1]['selected']
		else:
			parent = sel.parent
		context = dict(menu=self.player, selected=sel, parent=parent)
		s = ActionMenu(context, universe=self.player.universe)
		s.show()
		if sel == None:
			s.select(-1)
			s.select(1)
		return True

	def event_marker(self, event):
		play = self.player
		sel = play.selected
		if sel is None:
			log.warning('Nothing to put in markerlist')
			return True
		if isinstance(sel, Markerlist) or sel.universe == 'net_services':
			play._error_spawner()
		else:
			marker = markerlists()[self.player.universe]
			if sel.is_marked():
				marker.del_item(sel)
			else:
				w = None
				if isinstance(sel, DirItem):
					w = LoadingWindow('')
					w.show()
				marker.add_item(sel)
				if w:
					w.hide()
			play._update_marker()
		return True



class GridNavigatorEventHandler(NavigatorEventHandler):
	__doc__ = 'Event handler for grid navigators.'
	def event_up(self, event):
		self.player.select_vertical(-event.arg['count'])
		return True

	def event_down(self, event):
		self.player.select_vertical(event.arg['count'])
		return True

	def event_left(self, event):
		self.player.select_horizontal(-event.arg['count'])
		return True

	def event_right(self, event):
		self.player.select_horizontal(event.arg['count'])
		return True



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb774f94c>}
from __future__ import absolute_import
from .core import MenuEventHandler
from peewee.debug import GET_LOGGER
from pygui.item.mediaitem.core import DirItem
from pygui.markerlist import markerlists, Markerlist
from pygui.window import LoadingWindow
from pygui.shared import pygui_globs
log = GET_LOGGER(__name__)
class NavigatorEventHandler(MenuEventHandler):
	__doc__ = '\n    Event manager for Navigator (file browser)\n    '
	def __init__(self, player):
		MenuEventHandler.__init__(self, player)

	def event_right(self, event):
		self.player.browse_selected()
		return True

	def event_select(self, event):
		self.player.execute_selected()
		return True

	def event_left(self, event):
		self.player.browse_previous()
		return True

	def event_info(self, event):
		self.player.action_info()
		return True

	def event_stop(self, event):
		if pygui_globs['menustack'].get_player():
			self.player._error_spawner()
		return True

	def event_toggle_menu(self, event):
		if not pygui_globs['menustack'].toggle():
			self.player._error_spawner()
		return True

	def event_action_menu(self, event):
		sel = self.player.selected
		from pygui.menu.menu import ActionMenu
		parent = None
		if sel is None and self.player._history:
			parent = self.player._history[-1]['selected']
		else:
			parent = sel.parent
		context = dict(menu=self.player, selected=sel, parent=parent)
		s = ActionMenu(context, universe=self.player.universe)
		s.show()
		if sel == None:
			s.select(-1)
			s.select(1)
		return True

	def event_marker(self, event):
		play = self.player
		sel = play.selected
		if sel is None:
			log.warning('Nothing to put in markerlist')
			return True
		if isinstance(sel, Markerlist) or sel.universe == 'net_services':
			play._error_spawner()
		else:
			marker = markerlists()[self.player.universe]
			if sel.is_marked():
				marker.del_item(sel)
			else:
				w = None
				if isinstance(sel, DirItem):
					w = LoadingWindow('')
					w.show()
				marker.add_item(sel)
				if w:
					w.hide()
			play._update_marker()
		return True



class GridNavigatorEventHandler(NavigatorEventHandler):
	__doc__ = 'Event handler for grid navigators.'
	def event_up(self, event):
		self.player.select_vertical(-event.arg['count'])
		return True

	def event_down(self, event):
		self.player.select_vertical(event.arg['count'])
		return True

	def event_left(self, event):
		self.player.select_horizontal(-event.arg['count'])
		return True

	def event_right(self, event):
		self.player.select_horizontal(event.arg['count'])
		return True



